#!/user/bin/env node


const EventEmitter = require('events').EventEmitter,
      myEmitter = new EventEmitter();

setInterval(()=>{
  myEmitter.emit('hello');
  //console.log('running');
},1000);

myEmitter.on('hello',function prinHello(){
  console.log('hello World!');
});

setTimeout(()=>{
  myEmitter.emit('bye');
 // console.log('run bye');
},5000);

myEmitter.on('bye',function prinBye(){
  console.log('good bye!');
  process.exit();
});
